﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web;

namespace LifeTree.Mvc.ActionResults
{
    public class NotFoundResult : ActionResult
    {
        public string Message
        {
            get;
            set;
        }

        public override void ExecuteResult(ControllerContext context)
        {
            if (context.HttpContext.Request.IsAjaxRequest())
            {
                var jsonResult = new JsonResult() { Data = new { message = Message } };
                jsonResult.ExecuteResult(context);
            }
            else
            {
                throw new HttpException(404, Message);
            }
        }
    }
}
